// var rotate = function(nums, k) {
//     k = k % (nums.length)
//     let back = nums.splice(nums.length - k,k)
//     console.log(nums)
//     console.log(back)
//     return back.concat(nums)
//
// };


var rotate = function(nums, k) {
    k = k % (nums.length)
    let back = nums.splice(nums.length - k,k)
    let arr = [...back,...nums]
    return arr
};

console.log(rotate([1,2,3,4,5,6,7],3))
